<html>
<head><meta charset="utf-8"><title>debug!() · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debug!().html">debug!()</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="160348141"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debug%21%28%29/near/160348141" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debug!().html#160348141">(Mar 09 2019 at 03:42)</a>:</h4>
<p><code>debug!</code> automatically adds the timestamp but not the line number that inserts the debug text. Is it a deliberate choice ?</p>



<a name="160349429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debug%21%28%29/near/160349429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debug!().html#160349429">(Mar 09 2019 at 04:18)</a>:</h4>
<p><span class="user-mention" data-user-id="128294">@blitzerr</span> Yep, if you want the reverse (line number but no timestamp) you could use the dbg macro, e.g. <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=c49c663aea9b9b6c586cedbefbbc6ea3" target="_blank" title="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=c49c663aea9b9b6c586cedbefbbc6ea3">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=c49c663aea9b9b6c586cedbefbbc6ea3</a></p>



<a name="160349438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debug%21%28%29/near/160349438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debug!().html#160349438">(Mar 09 2019 at 04:19)</a>:</h4>
<p><code>debug!</code> comes from <code>log</code> by the way (and is pretty standard across the ecosystem)</p>



<a name="160350402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/debug%21%28%29/near/160350402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> blitzerr <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/debug!().html#160350402">(Mar 09 2019 at 04:45)</a>:</h4>
<p>Thanks a lot <span class="user-mention" data-user-id="116122">@simulacrum</span>. I was not trying to add new debug! but was trying to dump the ones that are already sprinkled all over rustc code. I was trying to understand why debug! was not generating line numbers but I guess the fact that it uses <code>log</code> underneath, would explain why. Thanks a lot.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>